/*
 * Dobol.java
 *
 * Created on 7 de noviembre de 2007, 18:56
 *
 * To change this template, choose Tools | Options and locate the template under
 * the Source Creation and Management node. Right-click the template and choose
 * Open. You can then make changes to the template in the Source Editor.
 */

package score.lang;

/**
 *
 * @author vramirez
 */
public class Dobol extends ScoreTaip{
    private double value;
    
    /** Creates a new instance of Dobol */
    public Dobol(String value) throws NumberFormatException{
        try{
        this.setValue(Double.parseDouble(value));
        }catch(Exception e){
            this.value=Double.MIN_VALUE;
        }
    }

    public double getValue() {
        return value;
    }

    public void setValue(double value) {
        this.value = value;
    }
    
    //pa' guardar como Varchar en la bddatos
    public String toEstring(){
        if(!this.toString().toUpperCase().equals("NULL"))
        return "'"+this.toString()+"'";
        else return "nUll";
    }
    
    //pa' guardar como Integer en la bddatos
    public String toYnteger(){
        return ""+Math.floor(value);        
    }
    
    //pa' guardar como Double
    public String toString(){
        if(value==Double.MIN_VALUE)
            return "nUll";
        return ""+value;
    }
}
